/* 聊天列表页面样式 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  height: 100vh;
  overflow: hidden;
  box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.18);
  border: none;
  outline: none;
  background: #E1E5F2;
  display: flex;
  box-sizing: border-box;
}

/* 主容器 */
.chat-container {
  display: flex;
  height: 100%;
  background: transparent;
  margin: 0;
  padding: 0;
  flex: 1;
  width: 100%;
  gap: 0;
}

/* 左侧边栏 */
.chat-sidebar {
  width: 280px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 搜索框 */
.search-box {
  padding: 12px;
  background: #f7f8fa;
  border-bottom: 1px solid #e5e6eb;
}

.search-box input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

/* 聊天列表 */
.chat-list {
  flex: 1;
  overflow-y: auto;
  background: white;
}

/* 聊天项 */
.chat-item {
  display: flex;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

.chat-item:hover {
  background: #f5f5f5;
}

.chat-item.active {
  background: #e6f7ff;
}

.chat-item.unread {
  background: #fafafa;
}

/* 头像 */
.chat-avatar {
  width: 37px;
  height: 37px;
  border-radius: 50%;
  margin-right: 12px;
  flex-shrink: 0;
  position: relative;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chat-avatar .status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #52c41a;
  border: 2px solid white;
}

.chat-avatar .status-dot.offline {
  background: #d9d9d9;
}

/* 聊天信息 */
.chat-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.chat-info-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.chat-name {
  font-size: 16px;
  font-weight: 500;
  color: #262626;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.chat-time {
  font-size: 11px;
  color: #8c8c8c;
  margin-left: 8px;
  white-space: nowrap;
}

.chat-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-message {
  font-size: 12px;
  color: #8c8c8c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.chat-item.unread .chat-message {
  color: #262626;
  font-weight: 500;
}

/* 未读标记 */
.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: #ff4d4f;
  color: white;
  font-size: 11px;
  font-weight: 500;
  border-radius: 9px;
  margin-left: 8px;
}

.chat-badge.dot {
  min-width: 8px;
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
}

/* 置顶标记 */
.chat-item.pinned {
  background: #fffbe6;
}

.chat-item.pinned::before {
  content: '📌';
  position: absolute;
  left: 4px;
  top: 4px;
  font-size: 10px;
}

/* 右侧聊天内容区域 */
.chat-content,
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
  overflow: hidden;
}

/* 空状态 */
.chat-empty,
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #bfbfbf;
}

.chat-welcome h2 {
  font-size: 20px;
  font-weight: 500;
  color: #262626;
  margin: 16px 0 8px 0;
}

.chat-welcome p {
  font-size: 14px;
  color: #8c8c8c;
}

.empty-text {
  font-size: 14px;
}

/* 聊天窗口 */
.chat-window {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
  overflow: hidden;
}

/* 聊天头部 */
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: white;
  border-bottom: 1px solid #e8e8e8;
  height: 60px;
}

.chat-header-info,
.contact-info {
  display: flex;
  align-items: center;
}

.chat-header-avatar,
.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-right: 12px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

.chat-header-name,
.contact-name {
  font-size: 16px;
  font-weight: 500;
  color: #262626;
  margin-bottom: 2px;
}

.chat-header-status,
.contact-status {
  font-size: 12px;
  color: #8c8c8c;
}

.contact-details {
  display: flex;
  flex-direction: column;
}

.chat-header-actions,
.chat-actions {
  display: flex;
  gap: 12px;
}

.header-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.header-btn:hover {
  background: #f5f5f5;
}

/* 消息区域 */
.chat-messages,
.message-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  background: #f5f5f5;
}

/* 消息项 */
.message-item {
  display: flex;
  margin-bottom: 16px;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-item.mine {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.message-item.mine .message-avatar {
  margin-left: 12px;
}

.message-item:not(.mine) .message-avatar {
  margin-right: 12px;
}

.message-content {
  max-width: 60%;
  display: flex;
  flex-direction: column;
}

.message-item.mine .message-content {
  align-items: flex-end;
}

.message-info {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
  color: #8c8c8c;
}

.notification-message .message-info {
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.message-item.mine .message-info {
  flex-direction: row-reverse;
}

.message-time {
  margin: 0 8px;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  position: relative;
}

.message-item:not(.mine) .message-bubble {
  background: white;
  color: #262626;
  border-top-left-radius: 2px;
}

.message-item.mine .message-bubble {
  background: #1890ff;
  color: white;
  border-top-right-radius: 2px;
}

/* 输入区域 */
.chat-input-area,
.input-area {
  background: white;
  border-top: 1px solid #e8e8e8;
  padding: 12px 20px;
}

.input-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.toolbar-btn,
.btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.toolbar-btn:hover,
.btn-icon:hover {
  background: #f5f5f5;
}

.input-box,
.input-wrapper {
  padding: 8px 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.input-box textarea,
.input-wrapper textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
}

.input-actions {
  padding: 8px 12px;
  display: flex;
  justify-content: flex-end;
}

.btn-send {
  padding: 6px 24px;
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-send:hover {
  background: #40a9ff;
}

.btn-send:active {
  background: #096dd9;
}

.btn-send:disabled {
  background: #d9d9d9;
  cursor: not-allowed;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #bfbfbf;
}

/* 时间分隔线 */
.time-divider {
  text-align: center;
  margin: 16px 0;
}

.time-divider span {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  font-size: 12px;
  color: #8c8c8c;
}

/* 系统消息 */
.system-message {
  text-align: center;
  margin: 12px 0;
  font-size: 12px;
  color: #8c8c8c;
}

/* ==================== 通知消息样式 ==================== */
.notification-message {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.notification-message.read {
  opacity: 0.7;
}

.notification-message.unread .message-bubble {
  border-left: 3px solid #1890ff;
}

.notification-bubble {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
  border: 1px solid #e5e6eb;
  padding: 16px !important;
  max-width: 600px;
}

.notification-title {
  font-size: 16px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 8px;
  line-height: 1.5;
}

.notification-content {
  font-size: 14px;
  color: #595959;
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.notification-image {
  max-width: 100%;
  border-radius: 6px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.notification-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.notif-action-btn {
  padding: 6px 16px;
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.notif-action-btn:hover {
  background: #40a9ff;
  transform: translateY(-1px);
}

.notif-action-btn:active {
  transform: translateY(0);
}

.notif-action-btn.mark-read {
  background: #52c41a;
}

.notif-action-btn.mark-read:hover {
  background: #73d13d;
}

.read-status {
  font-size: 13px;
  color: #52c41a;
  font-weight: 500;
}

.message-priority {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 6px;
  background: #f0f0f0;
  color: #595959;
}

.message-sender {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 置顶标记 */
.chat-item.pinned {
  background: #f0f7ff;
  border-left: 3px solid #1890ff;
}

.chat-item.pinned .chat-name::before {
  content: '📌 ';
  font-size: 12px;
}

/* ==================== 通知消息样式（用于模块） ==================== */
.notification-item {
  background: white;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.notification-item.read {
  opacity: 0.7;
}

.notification-item.unread {
  border-left: 3px solid #1890ff;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.1);
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.notification-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.notification-title-main {
  font-size: 16px;
  font-weight: 600;
  color: #262626;
  line-height: 1.5;
}

.notification-priority-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  flex-shrink: 0;
}

.notification-sender {
  font-size: 14px;
  font-weight: 600;
  color: #262626;
  display: flex;
  align-items: center;
  gap: 4px;
}

.notification-priority {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: #f0f0f0;
  color: #595959;
}

.notification-time {
  font-size: 12px;
  color: #8c8c8c;
  flex-shrink: 0;
}

.notification-body {
  margin-bottom: 12px;
}

.notification-title {
  font-size: 16px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 8px;
  line-height: 1.5;
}

.notification-content {
  font-size: 14px;
  color: #595959;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 8px;
}

.notification-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  margin-top: 8px;
}

.notification-footer {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  gap: 8px;
}

.btn-view-detail {
  padding: 6px 16px;
  background: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-view-detail:hover {
  background: #40a9ff;
  transform: translateY(-1px);
}

.btn-view-detail:active {
  transform: translateY(0);
}

.btn-mark-read {
  padding: 6px 16px;
  background: #52c41a;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mark-read:hover {
  background: #73d13d;
  transform: translateY(-1px);
}

.btn-mark-read:active {
  transform: translateY(0);
}

.read-status {
  font-size: 13px;
  color: #52c41a;
  font-weight: 500;
}

/* 聊天徽章 */
.chat-badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #ff4d4f;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* 空状态样式 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #8c8c8c;
}

.empty-text {
  font-size: 14px;
  text-align: center;
}

/* 响应式 */
@media (max-width: 768px) {
  .chat-sidebar {
    width: 100%;
  }
  
  .chat-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
  }
  
  .message-content {
    max-width: 80%;
  }
  
  .notification-bubble {
    max-width: 100%;
  }
  
  .notification-item {
    margin-bottom: 12px;
  }
}
